package com.gyg.enums;

import org.apache.commons.lang3.StringUtils;
/**
 * @author gyg
 * @version V1.0.0
 * @description: session存储内容
 * @date 2021/02/03 17:12
 */
public enum SessionEnum {

    OLD_CODE("oldCode", "验证码"),
    USER("admin_user", "登陆用户"),
    BLOCK("block", "锁屏");

    private String code;
    private String desc;

    SessionEnum (String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static SessionEnum getInstance(String code) {
        for (SessionEnum item : SessionEnum.values()) {
            if (StringUtils.equals(code, item.getCode())) {
                return item;
            }
        }
        return null;
    }
}
